import service from '../../http';
import { PageDTO, PageRetVO, RetVO } from '@/http/public.type.ts';
import { ArticleListVO, TagsVO } from './index.ts';
import {
  AddCommentDTO,
  CommentList,
  CommentTree
} from '@/pages/talk/talk.types.ts';

export function _pageArticleList(
  page: PageDTO
): Promise<PageRetVO<ArticleListVO[]>> {
  return service.post('/api/v1.0/article/pageArticleList', page);
}

export function _getRecommendArticle(
  page: PageDTO
): Promise<PageRetVO<ArticleListVO[]>> {
  return service.post('/api/v1.0/article/getRecommendArticle', page);
}

export function _getTopArticle(): Promise<RetVO<ArticleListVO>> {
  return service.post('/api/v1.0/article/getTopArticle');
}

export function _getTags(): Promise<RetVO<TagsVO[]>> {
  return service.post('/api/v1.0/tags/getTags');
}

export function _addArticleComment(param: AddCommentDTO): Promise<RetVO<any>> {
  return service.post('/api/v1.0/comment/addArticleComment', param);
}

export function _articleCommentTree(
  param: string
): Promise<RetVO<CommentTree[]>> {
  return service.post('/api/v1.0/comment/articleCommentTree', { id: param });
}

export function _commentList(): Promise<RetVO<CommentList[]>> {
  return service.post('/api/v1.0/comment/commentList');
}
